/******************************************************************************
 * FileName:    gwin_utc_clock.h
 * Desc:        世界时间
 *
 *
 * Author:      Lin
 * Notes:
 *
 ******************************************************************************/

#ifndef __GWIN_UTC_CLOCK_H__
#define __GWIN_UTC_CLOCK_H__

/*-------------------------- Includes ---------------------------------------*/
#include "stdint.h"
#include "stdlib.h"
#include "string.h"


/*-------------------------- Macro Definitions ------------------------------*/
#define DEFAULT_BEIJING_TIME                ( 1 )
#define ONE_DAY_MINUTE                      ( 1440 )    // 24 * 60
#define ONE_DAY_SECOND                      ( 86400 )   // 24 * 60 * 60 = 86400


#define HOUR_MINUTE_TO_CLOCK(hour, minute)  ((hour) * 60 + (minute))
#define CLOCK_TO_HOUR(clock)                ((clock) / 60)
#define CLOCK_TO_MINUTE(clock)              ((clock) % 60)


/*-------------------------- Type Declarations ------------------------------*/
/**
 * @brief 日期时间
 */
typedef struct
{
    uint16_t year;
    uint8_t month;
    uint8_t day;
    uint8_t hour;
    uint8_t minute;
    uint8_t second;
    uint8_t week;
}gwin_utc_clock_datetime_t;


/*-------------------------- Global Variables -------------------------------*/

/*-------------------------- Local Variables --------------------------------*/

/*-------------------------- Functions Declarations -------------------------*/

/*-------------------------- Functions Definitions --------------------------*/
void gwin_utc_clock_timestamp_to_datetime(const uint32_t *timestamp, gwin_utc_clock_datetime_t *datetime);
void gwin_utc_clock_datetime_to_timestamp(uint32_t *timestamp, const gwin_utc_clock_datetime_t *datetime);


#endif      // __GWIN_UTC_CLOCK_H__


/*-------------------------- END OF FILE ------------------------------------*/

